<?php
if (!defined('_THRIFT_CLIENT')) {
	include "ThriftClient.php";
}

include $GLOBALS['THRIFT_ROOT'] . '/packages/application/application.php';

class ApplicationService extends ThriftClient {
  
  public function __construct($server, $port){
    if (!isset($server)||!isset($port))
      return false;
      
    try {
      
      $this->_socket = new TSocket($server, $port);
      $this->_transport = new TBufferedTransport($this->_socket, 1024, 1024); //chua hieu 1024 la sao?
      $this->_protocol = new TBinaryProtocol($this->_transport);
      $this->_client_instance = new applicationClient($this->_protocol);
      
    } catch (TException $tx){
      
      return false;
    }
    
    return true;
  }
}

